/**
 * Copyright (c) 2013, 2018 itemis AG (http://www.itemis.eu) and others.
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License 2.0 which is available at
 * http://www.eclipse.org/legal/epl-2.0.
 * 
 * SPDX-License-Identifier: EPL-2.0
 */
package org.eclipse.xtend.core.tests.compiler;

import org.eclipse.xtend2.lib.StringConcatenation;
import org.junit.Test;

/**
 * @author Sebastian Zarnekow - Initial contribution and API
 */
@SuppressWarnings("all")
public class CompilerBug342021Test extends AbstractXtendCompilerTest {
  @Test
  public void testIfExpression_01() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("class C {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def Iterable<Object> m(String s) {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("if (true) ");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("[|<Object>newArrayList().iterator]");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("else");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("newArrayList(s).toArray");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.Iterator;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Conversions;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class C {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public Iterable<Object> m(final String s) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("Iterable<Object> _xifexpression = null;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("if (true) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("final Iterable<Object> _function = new Iterable<Object>() {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("public Iterator<Object> iterator() {");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("return CollectionLiterals.<Object>newArrayList().iterator();");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("_xifexpression = _function;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("} else {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("_xifexpression = (Iterable<Object>)Conversions.doWrapArray(CollectionLiterals.<String>newArrayList(s).toArray());");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return _xifexpression;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void testIfExpression_02() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("class C {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def Iterable<Object> m() {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("return if (true) ");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("[|<Object>newArrayList().iterator]");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("else");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("newArrayList(\'\').toArray");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.Iterator;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Conversions;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class C {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public Iterable<Object> m() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("Iterable<Object> _xifexpression = null;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("if (true) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("final Iterable<Object> _function = new Iterable<Object>() {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("public Iterator<Object> iterator() {");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("return CollectionLiterals.<Object>newArrayList().iterator();");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("_xifexpression = _function;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("} else {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("_xifexpression = (Iterable<Object>)Conversions.doWrapArray(CollectionLiterals.<String>newArrayList(\"\").toArray());");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return _xifexpression;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void testIfExpression_03() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("class C {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def Iterable<Object> m() {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("if (true) ");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("return [|<Object>newArrayList().iterator]");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("else");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("return newArrayList(\'\').toArray");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.Iterator;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Conversions;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class C {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public Iterable<Object> m() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("if (true) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("final Iterable<Object> _function = new Iterable<Object>() {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("public Iterator<Object> iterator() {");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("return CollectionLiterals.<Object>newArrayList().iterator();");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return _function;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("} else {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return (Iterable<Object>)Conversions.doWrapArray(CollectionLiterals.<String>newArrayList(\"\").toArray());");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void testIfExpression_04() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("class C {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def Iterable<Object> m() {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("if (true) ");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("return [|<Object>newArrayList().iterator]");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("else");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("newArrayList(\'\').toArray");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.Iterator;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Conversions;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class C {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public Iterable<Object> m() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("Object[] _xifexpression = null;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("if (true) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("final Iterable<Object> _function = new Iterable<Object>() {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("public Iterator<Object> iterator() {");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("return CollectionLiterals.<Object>newArrayList().iterator();");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return _function;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("} else {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("_xifexpression = CollectionLiterals.<String>newArrayList(\"\").toArray();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return (Iterable<Object>)Conversions.doWrapArray(_xifexpression);");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void testIfExpression_05() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("class C {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def Iterable<Object> m() {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("if (true) ");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("[|<Object>newArrayList().iterator]");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("else");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("return newArrayList(\'\').toArray");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.Iterator;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Conversions;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class C {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public Iterable<Object> m() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("Iterable<Object> _xifexpression = null;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("if (true) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("final Iterable<Object> _function = new Iterable<Object>() {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("public Iterator<Object> iterator() {");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("return CollectionLiterals.<Object>newArrayList().iterator();");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("_xifexpression = _function;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("} else {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return (Iterable<Object>)Conversions.doWrapArray(CollectionLiterals.<String>newArrayList(\"\").toArray());");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return _xifexpression;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void testIfExpression_06() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("class C {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def Iterable<Object> m(String s) {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("if (true) ");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("{ [| { <Object>newArrayList().iterator } ] }");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("else");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("{ { newArrayList(s).toArray } }");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.Iterator;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Conversions;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class C {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public Iterable<Object> m(final String s) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("Iterable<Object> _xifexpression = null;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("if (true) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("final Iterable<Object> _function = new Iterable<Object>() {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("public Iterator<Object> iterator() {");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("return CollectionLiterals.<Object>newArrayList().iterator();");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("_xifexpression = _function;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("} else {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("_xifexpression = (Iterable<Object>)Conversions.doWrapArray(CollectionLiterals.<String>newArrayList(s).toArray());");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return _xifexpression;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void testIfExpression_07() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("class C {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def Iterable<Object> m() {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("return { ");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("if (true) ");
    _builder.newLine();
    _builder.append("\t\t\t\t");
    _builder.append("{ [|<Object>newArrayList().iterator] }");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("else");
    _builder.newLine();
    _builder.append("\t\t\t\t");
    _builder.append("{ newArrayList(\'\').toArray }");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.Iterator;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Conversions;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class C {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public Iterable<Object> m() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("Iterable<Object> _xifexpression = null;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("if (true) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("final Iterable<Object> _function = new Iterable<Object>() {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("public Iterator<Object> iterator() {");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("return CollectionLiterals.<Object>newArrayList().iterator();");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("_xifexpression = _function;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("} else {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("_xifexpression = (Iterable<Object>)Conversions.doWrapArray(CollectionLiterals.<String>newArrayList(\"\").toArray());");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return _xifexpression;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void testIfExpression_08() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("class C {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def Iterable<Object> m() {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("{");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("if (true) ");
    _builder.newLine();
    _builder.append("\t\t\t\t");
    _builder.append("{ return { [|<Object>newArrayList().iterator] } }");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("else");
    _builder.newLine();
    _builder.append("\t\t\t\t");
    _builder.append("{ return { { newArrayList(\'\') } .toArray } }");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.Iterator;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Conversions;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class C {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public Iterable<Object> m() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("if (true) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("final Iterable<Object> _function = new Iterable<Object>() {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("public Iterator<Object> iterator() {");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("return CollectionLiterals.<Object>newArrayList().iterator();");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return _function;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("} else {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return (Iterable<Object>)Conversions.doWrapArray(CollectionLiterals.<String>newArrayList(\"\").toArray());");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void testIfExpression_09() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("class C {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def Iterable<Object> m() {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("if (true) ");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("{ return { [|<Object>newArrayList().iterator] } }");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("else");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("{ newArrayList(\'\').toArray }");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.Iterator;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Conversions;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class C {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public Iterable<Object> m() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("Object[] _xifexpression = null;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("if (true) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("final Iterable<Object> _function = new Iterable<Object>() {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("public Iterator<Object> iterator() {");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("return CollectionLiterals.<Object>newArrayList().iterator();");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return _function;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("} else {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("_xifexpression = CollectionLiterals.<String>newArrayList(\"\").toArray();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return (Iterable<Object>)Conversions.doWrapArray(_xifexpression);");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void testIfExpression_10() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("class C {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def Iterable<Object> m() {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("if (true) ");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("{ [|<Object>newArrayList().iterator] }");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("else");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("{ return newArrayList(\'\').toArray }");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.Iterator;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Conversions;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class C {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public Iterable<Object> m() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("Iterable<Object> _xifexpression = null;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("if (true) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("final Iterable<Object> _function = new Iterable<Object>() {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("public Iterator<Object> iterator() {");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("return CollectionLiterals.<Object>newArrayList().iterator();");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("_xifexpression = _function;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("} else {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return (Iterable<Object>)Conversions.doWrapArray(CollectionLiterals.<String>newArrayList(\"\").toArray());");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return _xifexpression;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void testIfExpression_11() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("class C {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def Iterable<Object> m(String s) {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("toString");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("if (true) {");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("toString;");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("[|<Object>newArrayList().iterator]");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("} else {");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("toString");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("newArrayList(s).toArray");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.Iterator;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Conversions;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class C {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public Iterable<Object> m(final String s) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("Iterable<Object> _xblockexpression = null;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("{");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.toString();");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("Iterable<Object> _xifexpression = null;");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("if (true) {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("Iterable<Object> _xblockexpression_1 = null;");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("{");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("this.toString();");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("final Iterable<Object> _function = new Iterable<Object>() {");
    _builder_1.newLine();
    _builder_1.append("            ");
    _builder_1.append("public Iterator<Object> iterator() {");
    _builder_1.newLine();
    _builder_1.append("              ");
    _builder_1.append("return CollectionLiterals.<Object>newArrayList().iterator();");
    _builder_1.newLine();
    _builder_1.append("            ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("_xblockexpression_1 = _function;");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("_xifexpression = _xblockexpression_1;");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("} else {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("Object[] _xblockexpression_2 = null;");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("{");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("this.toString();");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("_xblockexpression_2 = CollectionLiterals.<String>newArrayList(s).toArray();");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("_xifexpression = (Iterable<Object>)Conversions.doWrapArray(_xblockexpression_2);");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("_xblockexpression = _xifexpression;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return _xblockexpression;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void testIfExpression_12() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("class C {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def Iterable<Object> m() {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("toString");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("return {");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("toString");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("if (true) {");
    _builder.newLine();
    _builder.append("\t\t\t\t");
    _builder.append("toString;");
    _builder.newLine();
    _builder.append("\t\t\t\t");
    _builder.append("[|<Object>newArrayList().iterator]");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("} else {");
    _builder.newLine();
    _builder.append("\t\t\t\t");
    _builder.append("toString");
    _builder.newLine();
    _builder.append("\t\t\t\t");
    _builder.append("newArrayList(\'\').toArray");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.Iterator;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Conversions;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class C {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public Iterable<Object> m() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("this.toString();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("Iterable<Object> _xblockexpression = null;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("{");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.toString();");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("Iterable<Object> _xifexpression = null;");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("if (true) {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("Iterable<Object> _xblockexpression_1 = null;");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("{");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("this.toString();");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("final Iterable<Object> _function = new Iterable<Object>() {");
    _builder_1.newLine();
    _builder_1.append("            ");
    _builder_1.append("public Iterator<Object> iterator() {");
    _builder_1.newLine();
    _builder_1.append("              ");
    _builder_1.append("return CollectionLiterals.<Object>newArrayList().iterator();");
    _builder_1.newLine();
    _builder_1.append("            ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("_xblockexpression_1 = _function;");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("_xifexpression = _xblockexpression_1;");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("} else {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("Object[] _xblockexpression_2 = null;");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("{");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("this.toString();");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("_xblockexpression_2 = CollectionLiterals.<String>newArrayList(\"\").toArray();");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("_xifexpression = (Iterable<Object>)Conversions.doWrapArray(_xblockexpression_2);");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("_xblockexpression = _xifexpression;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return _xblockexpression;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void testIfExpression_13() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("class C {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def Iterable<Object> m() {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("toString");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("if (true) {");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("toString ");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("return [|<Object>newArrayList().iterator]");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("} else {");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("toString");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("return newArrayList(\'\').toArray");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.Iterator;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Conversions;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class C {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public Iterable<Object> m() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("this.toString();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("if (true) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.toString();");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("final Iterable<Object> _function = new Iterable<Object>() {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("public Iterator<Object> iterator() {");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("return CollectionLiterals.<Object>newArrayList().iterator();");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return _function;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("} else {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.toString();");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return (Iterable<Object>)Conversions.doWrapArray(CollectionLiterals.<String>newArrayList(\"\").toArray());");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void testIfExpression_14() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("class C {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def Iterable<Object> m() {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("toString");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("if (true) {");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("toString");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("return [|<Object>newArrayList().iterator]");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("} else {");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("toString");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("newArrayList(\'\').toArray");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.Iterator;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Conversions;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class C {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public Iterable<Object> m() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("Object[] _xblockexpression = null;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("{");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.toString();");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("Object[] _xifexpression = null;");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("if (true) {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("this.toString();");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("final Iterable<Object> _function = new Iterable<Object>() {");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("public Iterator<Object> iterator() {");
    _builder_1.newLine();
    _builder_1.append("            ");
    _builder_1.append("return CollectionLiterals.<Object>newArrayList().iterator();");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("return _function;");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("} else {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("Object[] _xblockexpression_1 = null;");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("{");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("this.toString();");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("_xblockexpression_1 = CollectionLiterals.<String>newArrayList(\"\").toArray();");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("_xifexpression = _xblockexpression_1;");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("_xblockexpression = _xifexpression;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return (Iterable<Object>)Conversions.doWrapArray(_xblockexpression);");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void testIfExpression_15() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("class C {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def Iterable<Object> m() {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("{");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("toString");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("if (true) {");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("{");
    _builder.newLine();
    _builder.append("\t\t\t\t");
    _builder.append("toString");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("[|<Object>newArrayList().iterator]");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("} else {");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("{");
    _builder.newLine();
    _builder.append("\t\t\t\t");
    _builder.append("toString");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("return newArrayList(\'\').toArray");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.Iterator;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Conversions;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class C {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public Iterable<Object> m() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("Iterable<Object> _xblockexpression = null;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("{");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.toString();");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("Iterable<Object> _xifexpression = null;");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("if (true) {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("Iterable<Object> _xblockexpression_1 = null;");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("{");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("this.toString();");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("final Iterable<Object> _function = new Iterable<Object>() {");
    _builder_1.newLine();
    _builder_1.append("            ");
    _builder_1.append("public Iterator<Object> iterator() {");
    _builder_1.newLine();
    _builder_1.append("              ");
    _builder_1.append("return CollectionLiterals.<Object>newArrayList().iterator();");
    _builder_1.newLine();
    _builder_1.append("            ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("_xblockexpression_1 = _function;");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("_xifexpression = _xblockexpression_1;");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("} else {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("this.toString();");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("return (Iterable<Object>)Conversions.doWrapArray(CollectionLiterals.<String>newArrayList(\"\").toArray());");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("_xblockexpression = _xifexpression;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return _xblockexpression;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void testSwitchExpression_01() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("class C {");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("def Iterable<Object> m(Object o) {");
    _builder.newLine();
    _builder.append("\t  ");
    _builder.append("switch o {");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("Boolean: [|<Object>newArrayList().iterator]");
    _builder.newLine();
    _builder.append("\t  \t");
    _builder.append("default: newArrayList(\'\').toArray");
    _builder.newLine();
    _builder.append("\t  ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.Iterator;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Conversions;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class C {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public Iterable<Object> m(final Object o) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("Iterable<Object> _switchResult = null;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("boolean _matched = false;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("if (o instanceof Boolean) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("_matched=true;");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("final Iterable<Object> _function = new Iterable<Object>() {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("public Iterator<Object> iterator() {");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("return CollectionLiterals.<Object>newArrayList().iterator();");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("_switchResult = _function;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("if (!_matched) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("_switchResult = (Iterable<Object>)Conversions.doWrapArray(CollectionLiterals.<String>newArrayList(\"\").toArray());");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return _switchResult;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void testSwitchExpression_02() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("class C {");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("def Iterable<Object> m(Object o) {");
    _builder.newLine();
    _builder.append("\t  ");
    _builder.append("switch o {");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("Boolean: [|<Object>newArrayList().iterator]");
    _builder.newLine();
    _builder.append("\t  \t");
    _builder.append("String: return newArrayList(\'\').toArray");
    _builder.newLine();
    _builder.append("\t  ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.Iterator;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Conversions;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class C {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public Iterable<Object> m(final Object o) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("Iterable<Object> _switchResult = null;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("boolean _matched = false;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("if (o instanceof Boolean) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("_matched=true;");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("final Iterable<Object> _function = new Iterable<Object>() {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("public Iterator<Object> iterator() {");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("return CollectionLiterals.<Object>newArrayList().iterator();");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("_switchResult = _function;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("if (!_matched) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("if (o instanceof String) {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("_matched=true;");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("return (Iterable<Object>)Conversions.doWrapArray(CollectionLiterals.<String>newArrayList(\"\").toArray());");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return _switchResult;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void testSwitchExpression_03() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("class C {");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("def Iterable<Object> m(Object o) {");
    _builder.newLine();
    _builder.append("\t  ");
    _builder.append("return switch o {");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("Boolean: [|<Object>newArrayList().iterator]");
    _builder.newLine();
    _builder.append("\t  \t");
    _builder.append("String: newArrayList(\'\').toArray");
    _builder.newLine();
    _builder.append("\t  \t");
    _builder.append("default: null");
    _builder.newLine();
    _builder.append("\t  ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.Iterator;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Conversions;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class C {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public Iterable<Object> m(final Object o) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("Iterable<Object> _switchResult = null;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("boolean _matched = false;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("if (o instanceof Boolean) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("_matched=true;");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("final Iterable<Object> _function = new Iterable<Object>() {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("public Iterator<Object> iterator() {");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("return CollectionLiterals.<Object>newArrayList().iterator();");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("_switchResult = _function;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("if (!_matched) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("if (o instanceof String) {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("_matched=true;");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("_switchResult = (Iterable<Object>)Conversions.doWrapArray(CollectionLiterals.<String>newArrayList(\"\").toArray());");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("if (!_matched) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("_switchResult = null;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return _switchResult;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void testSwitchExpression_04() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("class C {");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("def Iterable<Object> m(Object o) {");
    _builder.newLine();
    _builder.append("\t  ");
    _builder.append("return switch o {");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("Boolean: return [|<Object>newArrayList().iterator]");
    _builder.newLine();
    _builder.append("\t  \t");
    _builder.append("String: newArrayList(\'\').toArray");
    _builder.newLine();
    _builder.append("\t  \t");
    _builder.append("default: emptyList");
    _builder.newLine();
    _builder.append("\t  ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.Iterator;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Conversions;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class C {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public Iterable<Object> m(final Object o) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("Iterable<Object> _switchResult = null;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("boolean _matched = false;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("if (o instanceof Boolean) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("_matched=true;");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("final Iterable<Object> _function = new Iterable<Object>() {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("public Iterator<Object> iterator() {");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("return CollectionLiterals.<Object>newArrayList().iterator();");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return _function;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("if (!_matched) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("if (o instanceof String) {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("_matched=true;");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("_switchResult = (Iterable<Object>)Conversions.doWrapArray(CollectionLiterals.<String>newArrayList(\"\").toArray());");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("if (!_matched) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("_switchResult = CollectionLiterals.<Object>emptyList();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return _switchResult;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void testTryCatchExpression_01() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("class C {");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("def Iterable<Object> m(Object o) {");
    _builder.newLine();
    _builder.append("\t  ");
    _builder.append("try {");
    _builder.newLine();
    _builder.append("\t  \t");
    _builder.append("[|<Object>newArrayList().iterator]");
    _builder.newLine();
    _builder.append("\t  ");
    _builder.append("} catch(Exception e) {");
    _builder.newLine();
    _builder.append("\t  \t");
    _builder.append("newArrayList(\'\').toArray");
    _builder.newLine();
    _builder.append("\t  ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.Iterator;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Conversions;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Exceptions;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class C {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public Iterable<Object> m(final Object o) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("Iterable<Object> _xtrycatchfinallyexpression = null;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("try {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("final Iterable<Object> _function = new Iterable<Object>() {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("public Iterator<Object> iterator() {");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("return CollectionLiterals.<Object>newArrayList().iterator();");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("_xtrycatchfinallyexpression = _function;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("} catch (final Throwable _t) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("if (_t instanceof Exception) {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("_xtrycatchfinallyexpression = (Iterable<Object>)Conversions.doWrapArray(CollectionLiterals.<String>newArrayList(\"\").toArray());");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("} else {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("throw Exceptions.sneakyThrow(_t);");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return _xtrycatchfinallyexpression;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void testNestedIfInSwitchExpression_01() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("class C {");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("def Iterable<Object> m(Object o, boolean b) {");
    _builder.newLine();
    _builder.append("\t  ");
    _builder.append("switch o {");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("Boolean: [|<Object>newArrayList().iterator]");
    _builder.newLine();
    _builder.append("\t  \t");
    _builder.append("default: {");
    _builder.newLine();
    _builder.append("\t  \t\t");
    _builder.append("if (b)");
    _builder.newLine();
    _builder.append("\t  \t\t\t");
    _builder.append("return newArrayList(\'\').toArray");
    _builder.newLine();
    _builder.append("\t  \t\t");
    _builder.append("else");
    _builder.newLine();
    _builder.append("\t  \t\t\t");
    _builder.append("return #{}");
    _builder.newLine();
    _builder.append("\t  \t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t  ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.Collections;");
    _builder_1.newLine();
    _builder_1.append("import java.util.Iterator;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Conversions;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class C {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public Iterable<Object> m(final Object o, final boolean b) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("Iterable<Object> _switchResult = null;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("boolean _matched = false;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("if (o instanceof Boolean) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("_matched=true;");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("final Iterable<Object> _function = new Iterable<Object>() {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("public Iterator<Object> iterator() {");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("return CollectionLiterals.<Object>newArrayList().iterator();");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("_switchResult = _function;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("if (!_matched) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("if (b) {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("return (Iterable<Object>)Conversions.doWrapArray(CollectionLiterals.<String>newArrayList(\"\").toArray());");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("} else {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("return Collections.<Object>unmodifiableSet(CollectionLiterals.<Object>newHashSet());");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return _switchResult;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }
}
